Skip to content

Update flutter_barcode_scanner to v2.0.2: Restore Android v1 Embedding, Improve Lifecycle Stability, Add Platform Checks, Tests, and Documentation#3

Open
anan474 wants to merge 2 commits intodecodevM:masterfrom
anan474:master
Open

Update flutter_barcode_scanner to v2.0.2: Restore Android v1 Embedding, Improve Lifecycle Stability, Add Platform Checks, Tests, and Documentation#3
anan474 wants to merge 2 commits intodecodevM:masterfrom
anan474:master

Conversation

@anan474
Copy link

@anan474 anan474 commented Dec 2, 2025

This pull request updates the flutter_barcode_scanner plugin to version 2.0.2, with major improvements to platform support, Android compatibility, and error handling. The changes restore legacy Android embedding support, improve lifecycle management to prevent crashes, and ensure the plugin provides clear errors when invoked on unsupported platforms. Additionally, tests and documentation have been added to clarify platform expectations.

Platform Support & Error Handling

  • Added checks in flutter_barcode_scanner.dart to ensure plugin methods only run on Android/iOS, throwing a descriptive PlatformException for unsupported platforms and when the plugin is not registered. [1] [2] [3] [4]
  • Updated the README to document platform support and clarify behavior on non-mobile platforms.

Android Embedding & Lifecycle

  • Restored support for legacy v1 embedding via a new registerWith method in FlutterBarcodeScannerPlugin.java, using reflection to obtain the legacy registrar and dependencies. [1] [2]
  • Improved lifecycle observer management to prevent crashes when activities change, with proper cleanup for both v1 and v2 embeddings. [1] [2]

Compatibility & Dependency Updates

  • Changed the Android Gradle plugin version and repository from jcenter() to mavenCentral() for better compatibility.
  • Updated pubspec.yaml to version 2.0.2 and added missing test dependencies. [1] [2]

Testing & Tooling

  • Added a new test suite to verify platform checks and barcode scanning behavior.
  • Added LLDB integration scripts for iOS debugging (generated files). [1] [2]

Documentation

  • Updated CHANGELOG.md to reflect new features, bug fixes, and platform support clarifications.

@anan474
Copy link
Author

anan474 commented Dec 2, 2025

This PR address issue reported at FlutterFlow/flutterflow-issues#6176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant